<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
    
    <title>json</title>

  <script type="text/javascript" src="../js/jquery-1.8.2.js"></script></head>
 
  <body>
  <p>
Name: <span id="jname"></span><br />
Age: <span id="jage"></span><br />
Phone: <span id="jphone"></span><br />
txt: <span id="txt"></span><br />
jquery: <span id="jq"></span><br />
</p>
<textarea rows="3" cols="10"  id="textarea"></textarea>
<script type="text/javascript">
var JSONObject= {		
"name":"书根",
"age":21,
"phone":"123456"};
document.getElementById("jname").innerHTML=JSONObject.name;
document.getElementById("jage").innerHTML=JSONObject.age;
document.getElementById("jphone").innerHTML=JSONObject.phone;
var txt='{"result":['+
'{"a":"1","b":"2"},'+
'{"a":"3","b":"4"},'+
'{"a":"5","b":"6"}'+
']}';
var obj = eval ("(" + txt + ")");
document.getElementById("txt").innerHTML=obj.result[2].a;
$(document).ready(function(){
	$("#jq").text("1111");
	$("#btn").click(function(){
	 $.post("JsonAction!json",{jq:$("#jq").text()},function(data){
            alert(data);
            });
	});
});
//
$(document).ready(function(){
$("#btn2").click(function(){

$.post("getLoginList",
{id:1,
userName:"xiaoming",
passWord:"12312"
},
function(data){

	var result =$.parseJSON(data);
	
var s,d;
	
	 $(result).each(function(){
	s="id:"+this.id+"    userName:"+this.userName;
	});
	
	
	
	$("#textarea").attr({"rows":10,"cols":"20"})
	.text(s);								
							



}); 

;
});
});
</script>
  
  <input type="button" id="btn" value="changeJQ">
	<input type="button" id="btn2" value="传">
  
  </body>
</html>
